package day8;

import java.util.Scanner;

public interface Compute {
    int computer(int n, int m);
}

class addition implements Compute {
    public int computer(int n, int m) {
        return n + m;
    }
}

class subtraction implements Compute {
    public int computer(int n, int m) {
        return n - m;
    }
}

class multiplication implements Compute {
    public int computer(int n, int m) {
        return n * m;
    }
}

class division implements Compute {
    public int computer(int n, int m) {
        return n / m;
    }
}

class UseCompute{
    public void useCom(Compute com,int one,int two){
        com = new addition();
        int addition=com.computer(one,two);
        System.out.println("加:"+addition);
        com = new subtraction();
        int subtraction=com.computer(one,two);
        System.out.println("减:"+subtraction);
        com = new multiplication();
        int multiplication=com.computer(one,two);
        System.out.println("乘:"+multiplication);
        com = new division();
        int division=com.computer(one,two);
        System.out.println("除:"+division);
    }
}

class TestCompute {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入操作数n m");
        int n = sc.nextInt();
        int m = sc.nextInt();
        UseCompute uscom=new UseCompute();
        Compute com=null;
        uscom.useCom(com,n,m);
    }
}

